from bs4 import BeautifulSoup
import os, csv

for year in range(2018, 2019):
	wr = open("D:\\KIPRIS\\Biblio\\Biblio{}.xml".format(year), "w", encoding = "utf-8")
	folder = "D:\\KIPRIS\\Biblio\\{}".format(year)
	files = os.listdir(folder)
	for file in files:
		file_dir =  "D:\\KIPRIS\\Biblio\\{}\\".format(year) + file
		xml_file = open(file_dir, "r", encoding = "utf-8")
		xml = xml_file.read() + "\n"
		soup = BeautifulSoup(xml, "xml")
		apn = soup.find("applicationNumber")
		if apn != None:
			print(apn.text)
			wr.write(xml)